import React, { Component } from "react";
import "./VideoShow.css";
import axios from "axios";
export default class VideoShow extends Component {

    state = {
        douyin: {}
    }

    render() {
        return (
            <div className="container douyin-show">
                <h3 className="page-header">{this.state.douyin.desc}</h3>
                <div className="video">
                    <video
                        height="100%"
                        controls
                        src={this.state.douyin.video_local 
                            ? 'http://cdn.xiaohigh.com/' + this.state.douyin.video_local 
                            : ''
                        }
                    ></video>
                </div>
            </div>
        );
    }

    //
    async componentDidMount() {
        //定义一个 id
        let id = 3;
        //发送请求
        let result = await axios("http://api.xiaohigh.com/douyin/" + id);// 
        //设置状态
        this.setState({
            douyin: result.data
        })
        
    }
}
